package cn.markjoy.springbootrabbit.rabbit.producer;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.IOException;
import java.util.Date;
import java.util.concurrent.TimeoutException;

/**
 * @author zhaojiandong
 * @date 2018/9/3
 * @Description
 */
public class Messager
{

    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void send()
    {
        RabbitTemplate rabbitTemplate = new RabbitTemplate();
        String context = "hello " + new Date();
        System.out.println("following is message has send : " + context);
        System.out.println("-------------"+rabbitTemplate+"-------------");
        rabbitTemplate.convertAndSend("testQueue", context);
    }



}
